package com.xh.bussiness.thirdapi.xuebang.controller;

import com.xh.bussiness.thirdapi.xuebang.dto.VO.XuebangResultVO;
import com.xh.bussiness.thirdapi.xuebang.dto.request.QueryXuebnagClassLessonRequest;
import com.xh.bussiness.thirdapi.xuebang.service.IXuebangService;
import com.xh.core.annotation.ExcludeLoginTokenIntercept;
import com.xh.core.bean.AjaxResult;
import com.xh.core.constant.AjaxResultConstant;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Pitt Cheung
 * @date 2021/7/8 15:45
 */
@RestController
@RequestMapping("/xuebangApi")
public class XuebangTMSController {

    @Autowired
    private IXuebangService xuebangService;

    @ApiOperation("同步机构数据")
    @ExcludeLoginTokenIntercept
    @RequestMapping("/syncOrganization")
    public AjaxResult syncOrganization() {
        xuebangService.syncOrganization();
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS);
    }

    @ApiOperation("初始化角色数据")
    @ExcludeLoginTokenIntercept
    @RequestMapping("/initRole")
    public AjaxResult initRole() {
        xuebangService.initRole();
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS);
    }

    @ApiOperation("同步用户数据")
    @ExcludeLoginTokenIntercept
    @RequestMapping("/syncUser")
    public AjaxResult syncUser() {
        xuebangService.syncUser();
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS);
    }

    @ApiOperation("同步学生数据")
    @ExcludeLoginTokenIntercept
    @RequestMapping("/syncStudent")
    public AjaxResult syncStudent() {
        xuebangService.syncStudent();
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS);
    }


    @ApiOperation("查询学邦班课数据")
    @ExcludeLoginTokenIntercept
    @RequestMapping("/syncXuebangClass")
    public AjaxResult syncXuebangClass() {
        xuebangService.syncXuebangClass();
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS);
    }

    @ApiOperation("查询学邦班级排课数据")
    @ExcludeLoginTokenIntercept
    @RequestMapping("/queryXuebangClassLesson")
    public AjaxResult queryXuebangClassLesson(QueryXuebnagClassLessonRequest request) {
        XuebangResultVO resultVO = xuebangService.queryXuebangClassLesson(request);
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS, resultVO);
    }


}
